home *** CD-ROM | disk | FTP | other *** search
- /*\
- * ImTotal.rexx by IanSmith@psu.edu
- * Last revised: Wednesday 25-May-94 17:08:57
- * ---------------------------------------------------
- * Display rendering times for Imagine IFF files.
- * Imagine adds a IMRT hunk to all IFF files that
- * contains the date of the start and end of
- * rendering. This script will decode and display
- * the rendering times for those pictures. Version
- * 2.2 of rexxarplib.library is needed for wildcard
- * support. Format for times are, days hh:mm:ss.
- \*/
-
- If ~Show(l,'libs:rexxarplib.library') Then
- If ~AddLib('libs:rexxarplib.library',0,-30,0) Then
- Say "Oh no, rexxarplib.library is missing! No wildcards..."
- Total=0; TotalFiles=0
- Parse Arg PatternArg
- If Strip(PatternArg)="" Then Do
- Say "Please specify filename(s)"
- Say " Wildcards are supported if rexxarplib.library"
- Say " is installed in your libs: directory."
- Exit
- End
-
- Do Num=1 To Words(PatternArg)
- Pattern=Word(PatternArg,Num)
- If Show(l,'libs:rexxarplib.library') Then /* If rexxarplib is not */
- Matches=FileList(Pattern,Files,"F") /* here, try a single */
- Else Do /* file instead. */
- Matches=1
- Files.1=Pattern
- End
- Do I=1 To Matches
- Call Close(In)
- If Open(In,Files.I,"R")=0 Then
- Do
- Say "Can't open" Files.I
- Iterate
- End
- HunkHeader=ReadCH(In,8)
- If Left(HunkHeader,4)~="FORM" Then Do /* This does not handle CAT files */
- /* Say Files.I "is not an IFF." */ /* or nested ILBMs. Imagine only */
- Iterate /* puts out standard IFFs anyway. */
- End
- HunkHeader=ReadCH(In,4)
- If HunkHeader~="ILBM" Then Do
- /* Say Files.I "is not an ILBM." */ /* Remove the comments if you like */
- Iterate /* error messages. */
- End
- Done="F"; Days=""
- Do UNTIL EOF(In) | Done="T"
- HunkHeader=ReadCH(In,8)
- If Left(HunkHeader,4)="BODY" Then /* Stuff COULD come after the BODY */
- Done="T" /* hunk, but I've never seen it. */
- Else Do
- HunkData=ReadCH(In,C2D(Right(HunkHeader,4)))
- If Left(HunkHeader,4)="IMRT" Then Do
- SubTotal=Abs(C2D(Right(HunkData,4))-C2D(Left(HunkData,4)))
- Total=Total+SubTotal
- TotalFiles=TotalFiles+1
- If SubTotal%86400>0 Then
- Days=SubTotal%86400"d "
- Say Days||SubTotal%3600":"Right(SubTotal%60//60,2,"0")":"Right(SubTotal//60,2,"0") Files.I
- End
- End
- End
- End
- End
-
- If Total=0 Then
- Say "No files found."
- Else Do
- Days=Total%86400 /* If anyone needs this printed */
- Hours=Right(Total%3600//24,2,"0") /* in weeks and months, save your */
- Minutes=Right(Total%60//60,2,"0") /* money and get a 68060. :-) */
- Seconds=Right(Total//60,2,"0")
- If Days=0 Then Days=""
- Else Days=Days"d "
- TDays=(Total/TotalFiles)%86400
- THours=Right((Total/TotalFiles)%3600//24,2,"0")
- TMinutes=Right((Total/TotalFiles)%60//60,2,"0")
- TSeconds=Right((Total/TotalFiles)%1//60,2,"0")
- If TDays=0 Then TDays=""
- Else TDays=TDays"d "
- If TotalFiles=1 Then
- YSN=""
- Else
- YSN="s"
- Say "Total rendering time:" Days||Hours":"Minutes":"Seconds "("TotalFiles "file"YSN")"
- If TotalFiles>1 Then
- Say " Average render time:" TDays||THours":"TMinutes":"TSeconds
- End
-
-